#ifndef CHATMESSAGETOCLIENT_H
#define CHATMESSAGETOCLIENT_H

#include "./entities/message/superClass/message.h"


/*
Json数据格式
{
    "messageType": [ChatMessageToClient](int)
    "senderId": [senderId](string)
    "chatMessage": [chatMessage](string)
    "createTime: [sendTime](string)
    "id": [id](int) 这个字段用来确保收到客户端收到好友请求消息
}
*/
class ChatMessageToClient : public Message
{
public:
    ChatMessageToClient() = delete;

    ChatMessageToClient(const SenderId& senderId, const ChatMessage& chatMsg,
                        const CreateTime& sendTime, const int& id);
    ChatMessageToClient(const QJsonObject&);
    QJsonObject PackJsonData() const override;
    SenderId getSenderId() const;
    ChatMessage getChatMessage() const;
    CreateTime getSendTime() const;
    Id getId() const;

private:
    SenderId m_senderId;
    ChatMessage m_chatMessage;
    CreateTime m_sendTime;
    Id m_id;
};

// 编译时注册
Q_DECLARE_METATYPE(ChatMessageToClient)

#endif // CHATMESSAGETOCLIENT_H
